package flc.ast.adapter;

import android.graphics.Color;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.FormatBean;
import stark.common.basic.adaptermutil.StkEmptyProvider;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class FormatFblAdapter extends StkProviderMultiAdapter<FormatBean> {

    public FormatFblAdapter() {
        addItemProvider(new StkEmptyProvider<>(112));
        addItemProvider(new FormatFblProvider());
    }

    private class FormatFblProvider extends BaseItemProvider<FormatBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_format_fbl;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, FormatBean bean) {
            baseViewHolder.setText(R.id.tvFormatFblItemName,bean.getStr());
            baseViewHolder.setText(R.id.tvFormatFblItemArg,bean.getStr2());
            if (bean.isSelect()){
                baseViewHolder.setBackgroundColor(R.id.llFormatFblItem, Color.parseColor("#2F53FF"));
                baseViewHolder.setTextColor(R.id.tvFormatFblItemName, Color.parseColor("#FFFFFF"));
                baseViewHolder.setTextColor(R.id.tvFormatFblItemArg, Color.parseColor("#FFFFFF"));

            }else{
                baseViewHolder.setBackgroundColor(R.id.llFormatFblItem, Color.parseColor("#F8FAFC"));
                baseViewHolder.setTextColor(R.id.tvFormatFblItemName, Color.parseColor("#000000"));
                baseViewHolder.setTextColor(R.id.tvFormatFblItemArg, Color.parseColor("#000000"));
            }
        }
    }

}
